//
//  LibraryTableVCell.m
//  彩虹儿歌
//
//  Created by HelloWorld_L on 15/7/3.
//  Copyright (c) 2015年 HelloBaby. All rights reserved.
//

#import "LibraryTableVCell.h"
#import "MacroHeader.h"
#import <UIImageView+WebCache.h>
@implementation LibraryTableVCell

- (void)dealloc
{
    [_backGroundV release];
    [_playIndicImgV release];
    [_coverImgV release];
    [_titleLab release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self =[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.backGroundV = [[UIView alloc] initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH - 20, SCREEN_WIDTH / 3 + 20)];
//        self.backGroundV.backgroundColor = [UIColor colorWithRed:120 / 255.0 green:211 / 255.0 blue:250 / 255.0 alpha:0.3];
        self.backGroundV.backgroundColor = [UIColor colorWithWhite:1 alpha:0.7];
        self.backGroundV.layer.cornerRadius = 30;
        
        self.playIndicImgV = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 20 - 50, (self.backGroundV.frame.size.height - 30) / 2, 30, 30)];
        self.playIndicImgV.image = [UIImage imageNamed:@"xiaojiantou"];
        
        self.coverImgV = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH / 3, SCREEN_WIDTH / 3)];
        
        self.titleLab = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 3 + 20, SCREEN_WIDTH / 3 / 2, 200, 30)];
        self.titleLab.font = [UIFont systemFontOfSize:20];
        
        [self.backGroundV addSubview:self.playIndicImgV];
        
        [self.backGroundV addSubview:self.coverImgV];
        [self.backGroundV addSubview:self.titleLab];
        [self.contentView addSubview:self.backGroundV];
        [self.playIndicImgV release];
        [self.coverImgV release];
        [self.titleLab release];
        [self.backGroundV release];
        
    }
    return self;
}

- (void)setModel:(LibraryVCModel *)model
{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    [self.coverImgV sd_setImageWithURL:[NSURL URLWithString:[model.icon objectForKey:@"url"]] placeholderImage:[UIImage imageNamed:@"yuancaihong"]];
    
    self.titleLab.text = model.name;
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
